﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ProjectSunny.Admin.Controls
{
    public partial class AddYahooOnline : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtName.Text != "")
            {
                if (txtEmail.Text != "")
                {
                    if (fulBigImage.HasFile)
                    {
                        LIB.Validate saveimage = new LIB.Validate();
                        saveimage.ThayDoiKichThuocAnh(Server.MapPath("/Resources/Images/Image-Support/"), fulBigImage.FileName, 100, fulBigImage.PostedFile.InputStream);
                        string filePathBigIamge = "/Resources/Images/Image-Support/" + fulBigImage.FileName + "";
                        string values = "N'" + txtName.Text + "',N'" + filePathBigIamge + "',N'" + txtEmail.Text + "',N'"+txtSky.Text+"','"+txtPhone.Text+"'";

                        DAL.DCollector.DBCollector.Instance.StoredInsert("tbl_HelpOnline", values);
                        Response.Redirect("/Admin/Index.aspx?panel=7&sub=2");
                    }
                    else
                    {
                        Response.Write("<script>alert('Vui lòng nhập  file ảnh ...')</script>");

                    }
                }
                else
                {
                    Response.Write("<script>alert('Vui lòng nhập Yahoo hỗ trợ trực tuyến...')</script>");
                }

            }
            else
            {
                Response.Write("<script>alert('Vui lòng nhập tên hỗ trợ trực tuyến...')</script>");
            }

        }
    }
}